package com.bijiawang.user.mapper;

import com.bijiawang.user.bean.History;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;
import java.util.Date;

@Mapper
public interface HistoryMapper {
    @Select("SELECT * from history where username=#{username}")
    public ArrayList<History> findXm(String username);

    @Insert("insert into history(Id,username,goodsname,dtime,url) VALUES(#{Id},#{username},#{goodsname},#{dtime},#{url})")
    public void inser(History history);

    @Select("select * from history where url=#{url} and username=#{username}")
    public History sele(String url, String username);

    @Update("update history set dtime=#{dtime} where url=#{url} and username=#{username}")
    public void update(String url, String username, Date dtime);

    @Update("update history set username=#{newUsername} where username=#{oldUsername}")
    public void updateusername(String oldUsername,String newUsername);


    @Update("update favorites set userName=#{newUsername} where userName=#{oldUsername}")
    public void updateusername1(String oldUsername,String newUsername);

    @Update("update nfavorites set userName=#{newUsername} where userName=#{oldUsername}")
    public void updateusername2(String oldUsername,String newUsername);
}
